package com.mystudy.concurrent.designModel.singleThreadModel;

/**
 * TODO: 资源使用者
 *
 * @author acy
 * @since 2019/05/28 19:29
 */
public class UserModel extends Thread{
	private final String userName;
	private final String userAddress;
	private final Gate gate;

	public UserModel(String userName, String userAddress, Gate gate) {
		this.userName = userName;
		this.userAddress = userAddress;
		this.gate = gate;
	}

	@Override
	public void run() {
		System.out.println(userName+"BEGIN");
		while (true){
			this.gate.pass(userName,userAddress);
		}
	}
}
